From 3dedbaf9bc43bd04c5c10827f94ec06dd67b14a7 Mon Sep 17 00:00:00 2001 From: robertl Date: Wed, 16 Mar 2005 17:51:53 +0000 Subject: [PATCH] A bunch of uninteresting changes to make icc (and presumably other edgfe-based tools) whine less. coastexp: fix bounds violation on monthString delgpl: fix error text on fatal() geoniche: tweak terminator google: make seial an int, not long. gpx: include xmlgeneric lowrance: fix signedness writing waypoint count mapsource make le_f(read|write)64 explictly void nmea: add gratituous initialization overlay: explicitly zero zome values position: bloat 'nop' functions to eliminate need for cast. shape: close->SHPClose. misc warning fixes tpg: include ctype xmlgeneric.h: add many protos. --- gpsbabel/coastexp.c | 2 +- gpsbabel/delgpl.c | 2 +- gpsbabel/geoniche.c | 2 +- gpsbabel/google.c | 2 +- gpsbabel/gpx.c | 1 + gpsbabel/lowranceusr.c | 2 +- gpsbabel/mapsource.c | 2 ++ gpsbabel/nmea.c | 1 + gpsbabel/overlay.c | 6 ++++-- gpsbabel/position.c | 12 +++++++++--- gpsbabel/shape.c | 10 +++++++--- gpsbabel/tpg.c | 1 + gpsbabel/xmlgeneric.h | 17 ++++++++++++++--- 13 files changed, 44 insertions(+), 16 deletions(-) diff --git a/gpsbabel/coastexp.c b/gpsbabel/coastexp.c index 370e09623..e262285df 100755 --- a/gpsbabel/coastexp.c +++ b/gpsbabel/coastexp.c @@ -250,7 +250,7 @@ ce_cdata(void *dta, const XML_Char *s, int len) yearString[4] = '\0'; t.tm_year = atoi(yearString) - 1900; strncpy(monthString, currentMark->created+4, 2); - monthString[3] = '\0'; + monthString[2] = '\0'; t.tm_mon = atoi(monthString) - 1; strncpy(dayString, currentMark->created+6, 2); dayString[2] = '\0'; diff --git a/gpsbabel/delgpl.c b/gpsbabel/delgpl.c index f9d68c233..22c34b0fd 100644 --- a/gpsbabel/delgpl.c +++ b/gpsbabel/delgpl.c @@ -46,7 +46,7 @@ gpl_rd_init(const char *fname) { gplfile_in = xfopen(fname, "rb", MYNAME); if (sizeof(struct gpl_point) != 56) { - fatal(MYNAME, ": gpl_point is %d instead of 56.\n", + fatal(MYNAME ": gpl_point is %d instead of 56.\n", sizeof(struct gpl_point)); } } diff --git a/gpsbabel/geoniche.c b/gpsbabel/geoniche.c index bd1041856..c73ca8dbb 100644 --- a/gpsbabel/geoniche.c +++ b/gpsbabel/geoniche.c @@ -43,7 +43,7 @@ arglist_t Args[] = { "Database name (filename)", NULL, ARGTYPE_STRING }, {"category", &Arg_category, "Category name (Cache)", NULL, ARGTYPE_STRING }, - {0, 0, 0, 0 } + {0, 0, 0, 0, 0 } }; #define ARG_FREE(X) do { if (X) { xfree(X); X = NULL; } } while (0) diff --git a/gpsbabel/google.c b/gpsbabel/google.c index e5879360d..ffdc918ea 100644 --- a/gpsbabel/google.c +++ b/gpsbabel/google.c @@ -25,7 +25,7 @@ static char *script = NULL; FILE *fd; -static long serial = 0; +static int serial = 0; #define MYNAME "google" #define MY_CBUF 4096 diff --git a/gpsbabel/gpx.c b/gpsbabel/gpx.c index 2cd12d0d1..fd6a93a1d 100644 --- a/gpsbabel/gpx.c +++ b/gpsbabel/gpx.c @@ -20,6 +20,7 @@ */ #include "defs.h" +#include "xmlgeneric.h" #ifndef NO_EXPAT #include static XML_Parser psr; diff --git a/gpsbabel/lowranceusr.c b/gpsbabel/lowranceusr.c index cd996007e..e0fac3c95 100644 --- a/gpsbabel/lowranceusr.c +++ b/gpsbabel/lowranceusr.c @@ -288,7 +288,7 @@ lowranceusr_waypt_pr(const waypoint *wpt) int alt = wpt->altitude; /* our personal waypoint counter */ - my_fwrite2(&waypt_out_count, file_out); + my_fwrite2((short *) &waypt_out_count, file_out); waypt_out_count++; Lat = lat_deg_to_mm(wpt->latitude); diff --git a/gpsbabel/mapsource.c b/gpsbabel/mapsource.c index a7a2df5ac..83871c700 100644 --- a/gpsbabel/mapsource.c +++ b/gpsbabel/mapsource.c @@ -95,6 +95,7 @@ arglist_t mps_args[] = { * A wrapper to ensure the doubles we fwrite are in correct endianness. */ +void le_fwrite64(void *ptr, int sz, int ct, FILE *stream) { unsigned char cbuf[8]; @@ -107,6 +108,7 @@ le_fwrite64(void *ptr, int sz, int ct, FILE *stream) fwrite(cbuf, 8, 1, stream); } +void le_fread64(void *ptr, int sz, int ct, FILE *stream) { unsigned char cbuf[8]; diff --git a/gpsbabel/nmea.c b/gpsbabel/nmea.c index b42fa24f5..c5bba8ecb 100644 --- a/gpsbabel/nmea.c +++ b/gpsbabel/nmea.c @@ -454,5 +454,6 @@ ff_vecs_t nmea_vecs = { nmea_wr_deinit, nmea_read, nmea_write, + NULL, NULL }; diff --git a/gpsbabel/overlay.c b/gpsbabel/overlay.c index 60fd403e1..aac9e5cf3 100644 --- a/gpsbabel/overlay.c +++ b/gpsbabel/overlay.c @@ -223,7 +223,7 @@ void ovl_read(void) char *pstr; int keyw,i; double rwert; - route_head *route_head; + route_head *route_head = NULL; waypoint *wpt; int sym_cnt; @@ -568,10 +568,12 @@ void symbol_deinit(const route_head *hd) queue *elem, *tmp; waypoint *waypointp; int i; - double lat1, lon1, lat2, lon2; + double lat1,lon1,lat2,lon2; double lats,lons,late,lone; double dist,d,dd; + lat1 = lon1 = lat2 = lon2 = 0.0; + lats = lons = late = lone = 0.0; dist = 0.0; i = 0; QUEUE_FOR_EACH(&(hd->waypoint_list), elem, tmp) diff --git a/gpsbabel/position.c b/gpsbabel/position.c index 851257867..dbf54cd57 100644 --- a/gpsbabel/position.c +++ b/gpsbabel/position.c @@ -221,7 +221,13 @@ position_process_route(const route_head * rh) { } static void -position_noop(){ +position_noop_w(const waypoint *w) +{ +} + +static void +position_noop_t(const route_head *h) +{ } void position_process() @@ -231,8 +237,8 @@ void position_process() if (i) position_runqueue(&waypt_head, i, wptdata); - route_disp_all(position_process_route, position_noop, position_noop); - track_disp_all(position_process_route, position_noop, position_noop); + route_disp_all(position_process_route, position_noop_t, position_noop_w); + track_disp_all(position_process_route, position_noop_t, position_noop_w); } void diff --git a/gpsbabel/shape.c b/gpsbabel/shape.c index 14a35318a..4294e8172 100644 --- a/gpsbabel/shape.c +++ b/gpsbabel/shape.c @@ -100,7 +100,7 @@ my_read(void) void my_rd_deinit(void) { - close (ihandle); + SHPClose (ihandle); } void @@ -129,7 +129,7 @@ my_write_wpt(const waypoint *wpt) } void -poly_init() +poly_init(const route_head *h) { int ct = route_waypt_count(); polybufx = xcalloc(ct, sizeof(double)); @@ -148,7 +148,7 @@ poly_point(const waypoint *wpt) } void -poly_deinit() +poly_deinit(const route_head *h) { SHPObject *shpobject; shpobject = SHPCreateSimpleObject(SHPT_ARC, route_waypt_count(), @@ -185,6 +185,9 @@ my_write(void) } route_disp_all(poly_init, poly_deinit, poly_point); break; + case rtedata: + fatal(MYNAME ":Routes are not supported\n"); + break; } } @@ -197,5 +200,6 @@ ff_vecs_t shape_vecs = { my_wr_deinit, my_read, my_write, + NULL, NULL }; diff --git a/gpsbabel/tpg.c b/gpsbabel/tpg.c index e9e5a1a57..9eb3696b5 100644 --- a/gpsbabel/tpg.c +++ b/gpsbabel/tpg.c @@ -22,6 +22,7 @@ #include "defs.h" #include +#include #include "jeeps/gpsmath.h" /* for datum conversions */ #define MYNAME "TPG" diff --git a/gpsbabel/xmlgeneric.h b/gpsbabel/xmlgeneric.h index ec66ae0d3..35758b012 100644 --- a/gpsbabel/xmlgeneric.h +++ b/gpsbabel/xmlgeneric.h @@ -1,7 +1,7 @@ /* Header for our common utilities for XML-based formats. - Copyright (C) 2004 Robert Lipe, robertlipe@usa.net + Copyright (C) 2004, 2005 Robert Lipe, robertlipe@usa.net This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -37,11 +37,22 @@ typedef struct xg_tag_mapping { void write_xml_entity(FILE *ofd, const char *indent, - const char *tag, const char *value); + const char *tag, const char *value); +void write_xml_entity_begin0(FILE *ofd, const char *indent, + const char *tag); +void write_xml_entity_begin1(FILE *ofd, const char *indent, const char *tag, + const char *attr1, const char *attrval1); +void write_xml_entity_begin2(FILE *ofd, const char *indent, const char *tag, + const char *attr1, const char *attrval1, + const char *attr2, const char *attrval2); +void write_xml_entity_end(FILE *ofd, const char *indent, const char *tag); void write_optional_xml_entity(FILE *ofd, const char *indent, - const char *tag, const char *value); + const char *tag, const char *value); void xml_write_time(FILE *ofd, const time_t timep, char *elname); +void xml_fill_in_time(char *time_string, const time_t timep, + int long_or_short); +void write_xml_header(FILE *ofd); void xml_init(const char *fname, xg_tag_mapping *tbl); void xml_read(void); -- 2.30.2